#include <stdio.h>
#include <math.h>

int main()
{
    int a, b, c, d;
    int num;
    scanf("%d", &num);
    for (int i = 100; i <= num; i++)
    {
        d = i;
        a = d%10;
        b = (d/10)%10;
        c = (d/100)%10;
        if (d == pow(a, 3) + pow(b, 3) + pow(c, 3))
        printf("%d\n",d);
    }
    return 0;
}